﻿using Ordering.Domain.Seedwork;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace Ordering.Domain.AggregatesModel.OrderAggregate
{
    /// <summary>
    /// 订单明细
    /// </summary>
    public class OrderItem
        : Entity
    {
        /// <summary>
        /// 订单Id
        /// </summary>
        public int OrderId { get; set; }
        /// <summary>
        /// 产品代码
        /// </summary>
        public string ProductCode { get; set; }
        /// <summary>
        /// 单价
        /// </summary>
        [Column(TypeName = "decimal(18,2)")]
        public decimal ProductPrice { get; set; }
        /// <summary>
        /// 产品名称
        /// </summary>
        public string ProductName { get; set; }
        private string _ExtendField;
        /// <summary>
        /// 扩展字段（快递类型）
        /// </summary>
        public string ExtendField
        {
            get { return _ExtendField; }
            set
            {
                if (_ExtendField == value)
                    return;
                _ExtendField = value;
            }
        }
        private string _ExtendField2;
        /// <summary>
        /// 扩展字段2（取件码）
        /// </summary>
        public string ExtendField2
        {
            get { return _ExtendField2; }
            set
            {
                if (_ExtendField2 == value)
                    return;
                _ExtendField2 = value;
            }
        }
        private int _Num = 1;
        /// <summary>
        /// 数量
        /// </summary>
        public int Num
        {
            get { return _Num; }
            set
            {
                if (_Num == value)
                    return;
                _Num = value;
            }
        }
        private string _remark;
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark
        {
            get { return _remark; }
            set
            {
                if (_remark == value)
                    return;
                _remark = value;
            }
        }
        private string _PictureId;
        /// <summary>
        /// 产品图片Id（多个以;分割）
        /// </summary>
        public string PictureId
        {
            get { return _PictureId; }
            set
            {
                if (_PictureId == value)
                    return;
                _PictureId = value;
            }
        }
        protected OrderItem(){}
        public OrderItem(string productCode,decimal productPrice, string productName,int num = 1,string extendField = null,string remark = null,string pictureId = null)
        {
            this.ProductCode = productCode;
            this.ProductPrice = productPrice;
            this.Num = num;
            this.ProductName = productName;
            this.ExtendField = extendField;
            this.Remark = remark;
            this.PictureId = pictureId;
        }
    }
}
